<template>
  <view id="navbar">
    <!--首页背景内容-->
    <view
      class="navbar_box"
      v-if="navbarData.backgroundCor == 1 || navbarData.backgroundCor == 3"
      :style="{
        height: navbarData.statusBarHeight + navbarData.navHeight + 'px',
        background: navbarData.scrollWhite == 1 ? '#ffffff' : '',
      }"
    >
      <view
        class="nav_pos"
        :style="{
          height: navbarData.statusBarHeight + navbarData.navHeight + 'px',
        }"
      >
        <image
          @click="gobackpre()"
          :style="{ marginTop: navbarData.statusBarHeight + 10 + 'px' }"
          v-if="navbarData.showCapsule == 1"
          class="navbar_t_back"
          src="http://llg.qiniu.comeinvip.com/images/navbar/blockjt.png"
        >
        </image>
      </view>
    </view>
    <view
      class="navbar_top"
      v-if="navbarData.backgroundCor == 2"
      :style="{
        height: navbarData.statusBarHeight + navbarData.navHeight + 'px',
      }"
    >
      <view
        class="navbar_tit"
        :style="{ marginTop: navbarData.statusBarHeight + 'px' }"
      >
        <image
          @click="gobackpre()"
          v-if="navbarData.showCapsule == 1"
          class="navbar_t_back"
          src="http://llg.qiniu.comeinvip.com/images/navbar/return_icon_white.png"
        >
        </image>
        <image
          @click="gobackpre()"
          v-if="navbarData.showCapsule == 2"
          class="navbar_t_back"
          src="http://llg.qiniu.comeinvip.com/images/navbar/blockjt.png"
        >
        </image>
        <view class="nav_tit"
          ><text>{{ navbarData.titles }}</text></view
        >
      </view>
    </view>
  </view>
</template>

<script>
export default {
  props: {
    navbarData: {
      //navbarData   由父页面传递的数据，变量名字自命名
      type: Object,
      default: {
        showCapsule: Number,
      },
      observer: function (newVal, oldVal) {},
    },
  },
  data() {
    return {
      positionlook: false,
    };
  },
  onLoad() {},
  methods: {
    gobackpre() {
      uni.navigateBack();
    },
  },
  watch: {
    navbarData: {
      handler(newName, oldName) {
        // 初始化
      },
      deep: true,
    },
  },
};
</script>

<style>
#navbar {
  display: block;
  overflow: hidden;
  width: 750rpx;
  position: fixed;
  z-index: 999999999999;
  top: 0rpx;
  left: 0rpx;
}
.navbar_box {
  display: block;
  overflow: hidden;
  width: 750rpx;
  position: fixed;
  z-index: 999999999999;
  top: 0rpx;
  left: 0rpx;
}

.nav_pos {
  display: block;
  overflow: hidden;
  width: 750rpx;
  position: relative;
}

.navbar_bj {
  width: 750rpx;
}

.top_sel {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  width: 136rpx;
  height: 45rpx;
  background: #ffffff;
  box-shadow: 0px 3rpx 4rpx 0px rgba(85, 85, 85, 0.02);
  border-radius: 100rpx;
  opacity: 1;
  text-align: center;
  margin-left: 30rpx;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 999999999999999999999999999999999;
}

.top_sel image {
  border: none;
  width: 17rpx;
  height: 12rpx;
  margin-left: 5rpx;
}

.sel_name {
  color: #333;
  font-size: 28rpx;
}

.navbar_top {
  display: block;
  overflow: hidden;
  width: 750rpx;
  position: fixed;
  z-index: 999999999999999999999999999999999;
  top: 0rpx;
  left: 0rpx;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  background-color: #ffffff;
}

.nav_tit {
  width: 400rpx;
  text-align: center;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
}

.nav_tit text {
  font-size: 36rpx;
  font-weight: bold;
  color: #333;
}

.navbar_t_back {
  width: 33rpx;
  height: 33rpx;
  padding: 10rpx 80rpx 10rpx 30rpx;
}

.navbar_tit {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  position: relative;
}
</style>
